//
//  ColorKnobView.m
//  BlueToothProject
//
//  Created by foshou on 2017/3/2.
//  Copyright © 2017年 yxw. All rights reserved.
//

#import "ColorKnobView.h"
#import "DiyHeader.h"

@interface ColorKnobView ()

@property (nonatomic,strong) UIView *colorView;

@end

@implementation ColorKnobView

- (instancetype)initAtOrigin:(CGPoint)origin
{
    self = [super initWithFrame:CGRectMake(origin.x, origin.y, 28*MultipleWideth, 28*MultipleWideth)];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.layer.cornerRadius = 14*MultipleWideth;
        self.layer.masksToBounds = YES;
        self.layer.borderColor = [[UIColor blackColor] CGColor];
        self.layer.borderWidth = 0.5;
        
        CGFloat w = (28-8)*MultipleWideth;
        _colorView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, w, w)];
        _colorView.layer.cornerRadius = w/2.0;
        _colorView.layer.masksToBounds = YES;
        _colorView.center = CGPointMake(14*MultipleWideth, 14*MultipleWideth);
        [self addSubview:_colorView];
    }
    return self;
}

-(void)setCurrentColor:(UIColor *)currentColor
{
    _currentColor = currentColor;
    self.colorView.backgroundColor = currentColor;
}

@end
